package com.dgut.controller;

import com.dgut.pojo.QualificationCertificate;
import com.dgut.service.QualificationCertificateService;
import com.dgut.utils.PageRequestInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.concurrent.ConcurrentHashMap;

@CrossOrigin
@SuppressWarnings({"all"})
@Api("QualificationCertificateController")
@RestController
@RequestMapping("/qualificationCertificate")
public class QualificationCertificateController {

    @Resource
    private QualificationCertificateService qualificationCertificateService;

    /**
     * start-zwb
     */
    /**
     * end-zwb
     */


    /**
     * start-gxd
     */

    @ApiOperation("分页获取资质证照，返回QualificationCertificateList")
    @PostMapping("/getQualificationCertificateByPage")
    public Object getQualificationCertificateByPage(@ApiParam(value = "需要PageNum和PageSize的封装对象")
                                                    @RequestBody PageRequestInfo pageRequestInfo){
        return qualificationCertificateService.getQualificationCertificateByPage(pageRequestInfo);
    }

    @ApiOperation("资质证照模糊查询，返回QualificationCertificate")
    @GetMapping("/selectQualificationCertificateByName")
    public Object selectQualificationCertificateListByName(@ApiParam(value = "资质证照名称",required = false)
                                                           @RequestParam(required = false) String name){
        return qualificationCertificateService.selectQualificationCertificateListByName(name);
    }

    @ApiOperation("根据id查询资质证照，返回QualificationCertificate")
    @GetMapping("/selectQualificationCertificateById")
    public Object selectQualificationCertificateById(@ApiParam(value = "资质证照id",required = true)
                                                     @RequestParam(required = true) int id){
        return qualificationCertificateService.selectQualificationCertificateById(id);
    }

    @ApiOperation("购买资质证照，无返回值")
    @PostMapping("/buyQualificationCertificate")
    public Object buyQualificationCertificate(@ApiParam(value = "资质证照",required = true)
                                            @RequestBody(required = true) QualificationCertificate qualificationCertificate){
        return qualificationCertificateService.buyQualificationCertificate(qualificationCertificate);
    }

    /**
     * end-gxd
     */


    /**
     * start-lzh
     */
    /**
     * end-lzh
     */

    /**
     * start-hwf
     */
    /**
     * end-hwf
     */
    /**
     * start-hqq
     */
    @ApiOperation("通过名称分页查询上线的资质证照")
    @PostMapping("/getQualificationCertificateByName")
    Object getQualificationCertificateByName(@ApiParam(value = "页面信息") PageRequestInfo pageRequestInfo,
                                            @ApiParam(value = "资证名称",required = true) @RequestParam String name) {
        return qualificationCertificateService.getQualificationCertificateByName(pageRequestInfo,name);
    }
    /**
     * end-hqq
     */
}
